<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>layout页面布局</title>
		<script type="text/javascript" src="../js/jquery-1.8.3.js" ></script>
		<script type="text/javascript" src="../js/easyui/jquery.easyui.min.js" ></script>
		<script type="text/javascript" src="../js/easyui/locale/easyui-lang-zh_CN.js" ></script>
		<link rel="stylesheet" href="../js/easyui/themes/default/easyui.css" />
		<link rel="stylesheet" href="../js/easyui/themes/icon.css" />
		<script type="text/javascript" src="../js/ztree/jquery.ztree.all-3.5.js" ></script>
		<link rel="stylesheet" href="../js/ztree/zTreeStyle.css" />
		<script type="text/javascript">
			$(function(){
				
				var setting={
					data:{
						simpleData:{
							enable:true
						}
					},
					callback:{
						onClick:function(event, treeId, treeNode, clickFlag){
							var content = '<div style="width:100%;height:100%;overflow:hidden;">'
								+ '<iframe src="'
								+ treeNode.page
								+ '" scrolling="auto" style="width:100%;height:100%;border:0;" ></iframe></div>';
							if(treeNode.page != undefined && treeNode.page!=""){
								if($("#myTabs").tabs('exists',treeNode.name)){
									$("#myTabs").tabs('select',treeNode.name);
								}else{
									$("#myTabs").tabs('add',{
										title:treeNode.name,
										content:content
									});
								}
							}
						}
					}
				};
				var zNodes=[
					{id:1,pId:0,name:"父节点一"},
					{id:2,pId:0,name:"父节点二"},
					{id:11,pId:1,name:"子节点一"},
					{id:12,pId:1,name:"子节点二"},
					{id:13,pId:1,name:"子节点5"},
					{id:14,pId:2,name:"传智播客",page:"http://www.itcast.cn"},
					{id:15,pId:2,name:"百度",page:"http://www.baidu.com"},
					{id:16,pId:2,name:"解决6666"}
				];
				$.fn.zTree.init($("#baseMenu"),setting,zNodes);	
				
				$("#myTabs").tabs(
					{
						onContextMenu:function(e,title,index){
							//阻止浏览器默认菜单显示
							e.preventDefault();
							//显示自定义菜单
							$("#mm").menu(
								'show',{
									left:e.pageX,
									top:e.pageY
								}
							);
						}
					}
				)
			});
			
		</script>
	</head>
	<body class="easyui-layout">
		<div data-options="region:'north'" style="height: 100px;">北部区域</div>
		<div data-options="region:'west',title:'菜单导航'" style="width: 180px;">
			<!-- 折叠面板 -->
			<div class="easyui-accordion" data-options="fit:'true'">
				<div data-options="title:'基础菜单'">
					
					<ul id="baseMenu" class="ztree"></ul>
					
				</div>
				<div data-options="title:'系统菜单'">面板二</div>
			</div>
		</div>
		
		<div data-options="region:'center'" >
			<div id="myTabs" class="easyui-tabs" data-options="fit:'true'">
				<div data-options="title:'选项卡一',closable:true">选项卡一</div>
				<div data-options="title:'选项卡二'">选项卡二</div>
			</div>
		</div>
		<div data-options="region:'east'" style="width: 100px;">东部区域</div>
		<div data-options="region:'south'" style="height: 100px;">南部区域</div>
		
		<div id="mm" class="easyui-menu">
			<div>关闭当前窗口</div>
			<div>关闭其他窗口</div>
			<div class="menu-sep"></div>
			<div data-options="iconCls:'icon-cancel'">关闭所有窗口</div>
		</div>
	</body>
</html>
